home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / GNUstep / Makefiles / GNUstep-reset.sh < prev    next >
Encoding:
Text File  |  2008-01-16  |  5.8 KB  |  198 lines

  1. #   This file must be sourced inside (ba)sh using: .
  2. #
  3. #   GNUstep-reset.sh
  4. #
  5. #   Shell script resetting the GNUstep environment variables
  6. #
  7. #   Copyright (C) 2002 Free Software Foundation, Inc.
  8. #
  9. #   Author:  Nicola Pero <n.pero@mi.flashnet.it>
  10. #
  11. #   This file is part of the GNUstep Makefile Package.
  12. #
  13. #   This library is free software; you can redistribute it and/or
  14. #   modify it under the terms of the GNU General Public License
  15. #   as published by the Free Software Foundation; either version 3
  16. #   of the License, or (at your option) any later version.
  17. #   
  18. #   You should have received a copy of the GNU General Public
  19. #   License along with this library; see the file COPYING.
  20. #   If not, write to the Free Software Foundation,
  21. #   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  22. #
  23.  
  24. # This file is used to reset your environment.  This is needed if you
  25. # want to change LIBRARY_COMBO.  You first reset your environment, then
  26. # set a new LIBRARY_COMBO variable, then source GNUstep.sh again.
  27.  
  28. # This file resets variables in reverse order as they are set in the
  29. # GNUstep.sh file.
  30.  
  31. # This file only makes sense if you are using the standard GNUstep
  32. # filesystem structure.  If you're not, then your System Tools
  33. # directory could be /usr/bin, but you don't really want to remove
  34. # that from your PATH. :-)
  35.  
  36. # This function resets a path.
  37. # It takes two arguments: the name of the path variable to reset,
  38. # and a path fragment which is used to make our guess at what should
  39. # be removed more accurate.  All paths beginning with GNUSTEP_SYSTEM_ROOT, 
  40. # GNUSTEP_LOCAL_ROOT, GNUSTEP_NETWORK_ROOT and GNUSTEP_USER_ROOT 
  41. # followed by the specified path fragment are removed from the path
  42. # variable.  All other paths are kept unchanged.
  43. function reset_path 
  44. {
  45.   # Declare local variables
  46.   local original_path tmp_IFS temp_path dir gnustep_dir found
  47.  
  48.   # NB: We need to use eval because we want to access a variable
  49.   # whose name is another variable!
  50.   original_path=$(eval echo \$$1)
  51.   tmp_IFS="$IFS"
  52.   IFS=:
  53.   temp_path=
  54.   # Loop on the paths
  55.   for dir in $original_path; do
  56.     # For each of them, keep it only if it's not beginning with
  57.     # a path in GNUSTEP_PATHLIST as prefix
  58.     found=no;
  59.     for gnustep_dir in $GNUSTEP_PATHLIST; do
  60.       if [ -n "$gnustep_dir$2" ]; then
  61.         case "$dir" in
  62.           $gnustep_dir$2*)  found=yes; break;;
  63.           *);;
  64.         esac;
  65.       fi;
  66.     done;
  67.     if [ "$found" = "no" ]; then
  68.       if [ -z "$temp_path" ]; then
  69.         temp_path="$dir"
  70.       else
  71.         temp_path="$temp_path:$dir"
  72.       fi;
  73.     fi
  74.   done
  75.   IFS="$tmp_IFS"
  76.  
  77.   # Not set the path variable.
  78.   eval "$1=\$temp_path"
  79.   # Export it only if non empty, otherwise remove it completely from
  80.   # the shell environment.
  81.   temp_path=`eval echo \$"$1"`
  82.   if [ -z "$temp_path" ]; then
  83.     eval "unset $1"
  84.   else
  85.     eval "export $1"
  86.   fi
  87. }
  88.  
  89. reset_path INFOPATH /Library/Documentation/info
  90. reset_path GUILE_LOAD_PATH /Library/Libraries/Guile
  91. reset_path CLASSPATH /Library/Libraries/Java
  92. reset_path LD_LIBRARY_PATH /Library/Libraries
  93. reset_path DYLD_LIBRARY_PATH /Library/Libraries
  94. reset_path DYLD_FRAMEWORK_PATH /Library/Frameworks
  95. reset_path PATH /Tools
  96.  
  97. # Make sure we destroy the reset_path function after using it - we don't
  98. # want to pollute the environment with it.
  99. unset -f reset_path
  100.  
  101. unset GNUSTEP_SYSTEM_USERS_DIR
  102. unset GNUSTEP_NETWORK_USERS_DIR
  103. unset GNUSTEP_LOCAL_USERS_DIR
  104.  
  105. unset GNUSTEP_SYSTEM_APPS 
  106. unset GNUSTEP_SYSTEM_ADMIN_APPS 
  107. unset GNUSTEP_SYSTEM_WEB_APPS 
  108. unset GNUSTEP_SYSTEM_TOOLS 
  109. unset GNUSTEP_SYSTEM_ADMIN_TOOLS 
  110. unset GNUSTEP_SYSTEM_LIBRARY
  111. unset GNUSTEP_SYSTEM_HEADERS 
  112. unset GNUSTEP_SYSTEM_LIBRARIES 
  113. unset GNUSTEP_SYSTEM_RESOURCES 
  114. unset GNUSTEP_SYSTEM_JAVA 
  115. unset GNUSTEP_SYSTEM_DOC 
  116. unset GNUSTEP_SYSTEM_DOC_MAN
  117. unset GNUSTEP_SYSTEM_DOC_INFO
  118.  
  119. unset GNUSTEP_NETWORK_APPS 
  120. unset GNUSTEP_NETWORK_ADMIN_APPS 
  121. unset GNUSTEP_NETWORK_WEB_APPS 
  122. unset GNUSTEP_NETWORK_TOOLS 
  123. unset GNUSTEP_NETWORK_ADMIN_TOOLS 
  124. unset GNUSTEP_NETWORK_LIBRARY
  125. unset GNUSTEP_NETWORK_HEADERS 
  126. unset GNUSTEP_NETWORK_LIBRARIES 
  127. unset GNUSTEP_NETWORK_RESOURCES 
  128. unset GNUSTEP_NETWORK_JAVA 
  129. unset GNUSTEP_NETWORK_DOC 
  130. unset GNUSTEP_NETWORK_DOC_MAN
  131. unset GNUSTEP_NETWORK_DOC_INFO
  132.  
  133. unset GNUSTEP_LOCAL_APPS 
  134. unset GNUSTEP_LOCAL_ADMIN_APPS 
  135. unset GNUSTEP_LOCAL_WEB_APPS 
  136. unset GNUSTEP_LOCAL_TOOLS 
  137. unset GNUSTEP_LOCAL_ADMIN_TOOLS 
  138. unset GNUSTEP_LOCAL_LIBRARY
  139. unset GNUSTEP_LOCAL_HEADERS 
  140. unset GNUSTEP_LOCAL_LIBRARIES 
  141. unset GNUSTEP_LOCAL_RESOURCES 
  142. unset GNUSTEP_LOCAL_JAVA 
  143. unset GNUSTEP_LOCAL_DOC 
  144. unset GNUSTEP_LOCAL_DOC_MAN
  145. unset GNUSTEP_LOCAL_DOC_INFO
  146.  
  147. unset GNUSTEP_USER_APPS 
  148. unset GNUSTEP_USER_ADMIN_APPS
  149. unset GNUSTEP_USER_WEB_APPS
  150. unset GNUSTEP_USER_TOOLS 
  151. unset GNUSTEP_USER_ADMIN_TOOLS
  152. unset GNUSTEP_USER_LIBRARY
  153. unset GNUSTEP_USER_HEADERS 
  154. unset GNUSTEP_USER_LIBRARIES 
  155. unset GNUSTEP_USER_RESOURCES 
  156. unset GNUSTEP_USER_JAVA 
  157. unset GNUSTEP_USER_DOC 
  158. unset GNUSTEP_USER_DOC_MAN
  159. unset GNUSTEP_USER_DOC_INFO
  160.  
  161. # These should not defined, but might be if something goes wrong
  162. # somewhere.
  163. unset GNUSTEP_MAKE_STRICT_V2_MODE
  164. unset GNUSTEP_USER_DIR_APPS 
  165. unset GNUSTEP_USER_DIR_ADMIN_APPS
  166. unset GNUSTEP_USER_DIR_WEB_APPS
  167. unset GNUSTEP_USER_DIR_TOOLS 
  168. unset GNUSTEP_USER_DIR_ADMIN_TOOLS 
  169. unset GNUSTEP_USER_DIR_LIBRARY
  170. unset GNUSTEP_USER_DIR_HEADERS 
  171. unset GNUSTEP_USER_DIR_LIBRARIES 
  172. unset GNUSTEP_USER_DIR_RESOURCES 
  173. unset GNUSTEP_USER_DIR_JAVA 
  174. unset GNUSTEP_USER_DIR_DOC 
  175. unset GNUSTEP_USER_DIR_DOC_MAN
  176. unset GNUSTEP_USER_DIR_DOC_INFO
  177.  
  178. unset GNUSTEP_PATHLIST
  179. unset GNUSTEP_USER_ROOT
  180. unset GNUSTEP_HOST_OS
  181. unset GNUSTEP_HOST_VENDOR
  182. unset GNUSTEP_HOST_CPU
  183. unset GNUSTEP_HOST
  184. unset GNUSTEP_NETWORK_ROOT
  185. unset GNUSTEP_LOCAL_ROOT
  186. unset GNUSTEP_MAKEFILES
  187. unset GNUSTEP_FLATTENED
  188. unset GNUSTEP_IS_FLATTENED
  189. unset GNUSTEP_SYSTEM_ROOT
  190. unset GNUSTEP_ROOT
  191. unset LIBRARY_COMBO
  192.  
  193. unset GNUSTEP_CONFIG_FILE
  194. unset GNUSTEP_USER_CONFIG_FILE
  195. unset GNUSTEP_USER_DIR
  196. unset GNUSTEP_USER_DEFAULTS_DIR
  197.  
  198.